<template>
  <el-menu
      style="width: 200px;min-height: calc(100vh - 50px);background:linear-gradient(0deg,#1deca4,#61b9dc)"
      :uniqueOpened="true"
      default-active="/info"
      class="el-menu-vertical-demo"
      router
      background-color="inherit"
      text-color="#fff"
      active-text-color="#ffd04b">
<!--    <el-submenu index="/1">-->
<!--      <template #title>系统管理</template>-->
<!--      <el-menu-item index="/user" v-if="user.role===1">用户管理</el-menu-item>-->
<!--    </el-submenu>-->
    <el-menu-item index="/info" ><i class="el-icon-s-home"></i>首页</el-menu-item>
    <el-menu-item index="/person" v-if="user.role===1"><i class="el-icon-user-solid"></i>个人信息</el-menu-item>
    <el-menu-item index="/user" v-if="user.role===1"><i class="el-icon-s-custom"></i>用户管理</el-menu-item>
    <el-menu-item index="/memberVip" v-if="user.role===1"><i class="el-icon-s-data"></i>会员管理</el-menu-item>
    <el-menu-item index="/coach" v-if="user.role===1"><i class="el-icon-bicycle"></i>教练管理</el-menu-item>
    <el-menu-item index="/course" v-if="user.role===1"><i class="el-icon-date"></i>课程管理</el-menu-item>
    <el-menu-item index="/equipment" v-if="user.role===1"><i class="el-icon-basketball"></i>设备管理</el-menu-item>
    <el-menu-item index="/approveLeave" v-if="user.role===1"><i class="el-icon-chat-line-round"></i>审核批假</el-menu-item>
    <el-menu-item index="/member" v-if="user.role===2"><i class="el-icon-user-solid"></i>个人信息</el-menu-item>
    <el-menu-item index="/courseBuy" v-if="user.role===2"><i class="el-icon-shopping-cart-full"></i>课程购买</el-menu-item>
<!--    <el-menu-item index="/coachBuy" v-if="user.role===2">预约教练</el-menu-item>-->
    <el-menu-item index="/consumRecord" v-if="user.role===2"><i class="el-icon-coin"></i>消费记录</el-menu-item>
    <el-menu-item index="/courseOrder" v-if="user.role===2"><i class="el-icon-date"></i>预约课程</el-menu-item>
    <el-menu-item index="/coachInfo" v-if="user.role===3"><i class="el-icon-user-solid"></i>个人信息</el-menu-item>
    <el-menu-item index="/studentInfo" v-if="user.role===3"><i class="el-icon-s-custom"></i>学员信息</el-menu-item>
    <el-menu-item index="/coursePlan" v-if="user.role===3"><i class="el-icon-date"></i>课程安排</el-menu-item>
    <el-menu-item index="/leave" v-if="user.role===3"><i class="el-icon-thumb"></i>自主请假</el-menu-item>
<!--    <el-menu-item index="/book">书籍管理</el-menu-item>-->
<!--    <el-menu-item index="/news">新闻管理</el-menu-item>-->
  </el-menu>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "Aside",
  data(){
    return{
      user:{},
    }
  },
  created() {
    let userStr =sessionStorage.getItem("user") || '{}';
    this.user = JSON.parse(userStr);
//请求后端服务器，确认当前登录用户的合法性
    request.get("/api/user/"+this.user.id).then(res=>{
      if (res.code==='0'){
        this.user = res.data;
      }
    });
  },
  methods:{

  }
}
</script>

<style scoped>

</style>
